from selenium import webdriver
from time import sleep
from selenium.webdriver.common.by import By

driver=webdriver.Firefox()
driver.maximize_window()
driver.get('file:///C:/Users/HP/Desktop/loginlx/login%20(1).html')

#进入框架
ifname=driver.find_element(By.XPATH,'//*[@id="register"]')
driver.switch_to.frame(ifname)
sleep(2)


#定位注册账号输入框
driver.find_element(By.CLASS_NAME,'placeholder').send_keys('admin')
sleep(2)

#定位注册密码输入框
driver.find_element(By.ID,'pwd').send_keys('123456')
sleep(2)

#定位注册密码确认框
driver.find_element(By.XPATH,'//*[@id="pwd_"]').send_keys('123456')
sleep(2)

#点击注册
driver.find_element(By.ID,'prompt').click()
sleep(2)

#弹窗
alert=driver.switch_to.alert
alert.send_keys('lcf')
alert.accept()
sleep(2)

#进入框架